#! /usr/bin/python
# coding: utf-8

'''
Cancel/Break/BackSpace/Tab/Return/Shift_L/Shift_R/Control_L/Control_R/Alt_L/Alt_R/Pause
Caps_Lock/Escape/Prior(Page Up)/Next(Page
Down)/End/Home/Left/Up/Right/Down/Print/Insert/Delete/F1-12/Num_Lock/Scroll_Lock
'''

from Tkinter import *

root = Tk()

def printCoords(event):
    print 'event.char=', event.char
    print 'event.keycode=', event.keycode

bt1 = Button(root, text='Press BackSpace')
bt1.bind('<BackSpace>', printCoords)

bt2 = Button(root, text='Press Enter')
bt2.bind('<Return>', printCoords)

bt3 = Button(root, text='Press F5')
bt3.bind('<F5>', printCoords)

bt4 = Button(root, text='Press left shift')
bt4.bind('<Shift_L>', printCoords)

bt5 = Button(root, text='Press right shift')
bt5.bind('<Shift_R>', printCoords)

bt1.focus_set()

bt1.grid()
bt2.grid()
bt3.grid()
bt4.grid()
bt5.grid()

root.mainloop()
